Skip to contentSkip to conversation

Question about Using Grant Table

DISCUSSION 吴佳民 2 participants 2 messages Jul 11, 2008

lore
Share & tools
lore

吴佳民

author
#0 lore raw

Hi:
There is a code sample in <The Definite Guide to the Xen Hypervisor>, chapter 4, "Using Grant Tables". The code sample is as following:
#include <public/xen.h>
extern void * shared_page;
extern grant_entry_t * grant_table;

  void offer_page()
   {
        uint16_t flags;
       /* create the grant table*/
      gnttab_setup_table_t setup_op;
     setup_op.dom =DOMID_SELF;
     setup_op.nr_frames = 1;
     setup_op.frame_list = grant_table;
    
     HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup_op, 1);

    /*offer the grant */
    grant_table[0].domid=DOMID_FRIEND;
    grant_table[0].frame = shared_page >>12;
    flgas = GTF_permit_access & GTF_reading & GTF_writing;
    grant_table[0].flags= flags;
  
    }
   
    and it also assume that the grant table entry have already been communicated via Xenstore.

My question is :
If I modify this code sample and use it in my own program, How can I handle "extern void * shared_page; extern grant_entry_t * grant_table"?? Where Can I get the pointer to them?

Thanks a lot.
Danius Wu
=========================================================

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 1 line · 吴佳民, le Fri 11 Jul 2008 08:02:28 +0800, a écrit :

There is a code sample in <The Definite Guide to the Xen Hypervisor>,

That code is not meant to be used in userlevel, but in a PV kernel. If you want to manipulate grant tables from userland, use libxc's xc_gnttab_* functions.

Samuel